﻿using System;

namespace WinSource.Model.Helpers
{
    public static class DateHelper
    {
        #region Methods

        public static string GetDateDifferenceText(DateTime date)
        {
            string dateDifference;
            int numberOfDays = (int)(DateTime.Now - date).TotalDays;

            if (numberOfDays >= 0)
            {
                switch (numberOfDays)
                {
                    case 0:
                        dateDifference = "Today";
                        break;

                    case 1:
                        dateDifference = "Yesterday";
                        break;

                    default:
                        dateDifference = string.Format("{0} days ago", numberOfDays);
                        break;
                }
            }
            else
            {
                dateDifference = "Today";
            }

            return dateDifference;
        }

        #endregion
    }
}